// 存储
export const sessionSet = <T>(key: string, value: T): void => {
  sessionStorage.setItem('_' + key, JSON.stringify(value));
}


// 取出
export const sessionGet = <T>(key: string): T | null => {
  const data = sessionStorage.getItem('_' + key);
  return data ? JSON.parse(data) as T : null;
}

// 移除
export const sessionRemove = (key:string) => {
  sessionStorage.removeItem(key)
}

// 全部清除
export const sessionClear = () => {
  sessionStorage.clear()
}
